Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

76-tgyuuAn #246

Merged
merged 2 commits into from
Sep 20, 2024
Merged

76-tgyuuAn #246

merged 2 commits into from
Sep 20, 2024

Conversation

tgyuuAn
Copy link
Member

@tgyuuAn tgyuuAn commented Sep 8, 2024

πŸ”— 문제 링크

ν‘œν˜„ κ°€λŠ₯ν•œ μ΄μ§„νŠΈλ¦¬

μ–΄λ ΅λ‹€........

βœ”οΈ μ†Œμš”λœ μ‹œκ°„

1μ‹œκ°„ 이상

ν’€λ‹€κ°€ λͺ¨λ₯΄κ² μ–΄μ„œ ꡬ글링 ν›„ μŠ€ν„°λ””..

✨ μˆ˜λ„ μ½”λ“œ

image

문제 μ„€λͺ…

  1. μˆ˜κ°€ μ£Όμ–΄μ‘Œμ„ λ–„ ν•΄λ‹Ή 수λ₯Ό μ΄μ§„μˆ˜λ‘œ λ³€κ²½

  2. 포화 이진 트리둜 λ§Œλ“€μ—ˆμ„ λ•Œ ν•΄λ‹Ή 수λ₯Ό ν‘œν˜„ν•  수 μžˆλŠ”μ§€ 체크.

  3. μ—¬κΈ°μ„œ ν‘œν˜„ν•  수 μžˆλŠ” κ²ƒμ΄λž€, 이진 νŠΈλ¦¬μ— 더미 λ…Έλ“œλ₯Ό μΆ”κ°€ν•΄μ„œ 포화 μ΄μ§„νŠΈλ¦¬λ‘œ λ§Œλ“œλŠ”λ°,

더미 λ…Έλ“œλŠ” 싀체가 μžˆλŠ” λ…Έλ“œμ˜ μžμ‹μœΌλ‘œλ§Œ 뢙일 수 있음.

이 λ•Œ, μ™Όμͺ½λΆ€ν„° λ…Έλ“œλ₯Ό μ½μ–΄μ„œ 싀체 λ…Έλ“œλ©΄ 1, 더미 λ…Έλ“œλ©΄ 0을 μ±„μ›Œλ‚˜κ°.




풀지 λͺ»ν•œ 이유

-> 문제λ₯Ό λ„ˆλ¬΄ μ–΄λ ΅κ²Œ μƒκ°ν•˜μ—¬μ„œ μƒκ°λ§Œ ν•˜κ³  μ‹œλ„ν•΄λ³΄μ§€ μ•ŠμŒ.

-> λ¬Έμ œμ—μ„œ 주어진 κ·ΈλŒ€λ‘œ μ ‘κ·Όν–ˆμœΌλ©΄ ν’€ 수 μžˆλŠ” 문제.




ν‘ΈλŠ” 방법

  1. 주어진 수λ₯Ό μ΄μ§„μˆ˜λ‘œ λ³€κ²½

  2. ν•΄λ‹Ή μ΄μ§„μˆ˜λ₯Ό 포화 이진 트리의 개수만큼 수λ₯Ό μ±„μ›Œλ‚˜κ°.
    _(수λ₯Ό μ±„μ›Œλ‚˜κ°„λ‹€λŠ” λœ»μ€ 이진 수의 μ™Όμͺ½μ— 0을 μ±„μ›Œλ‚˜κ°„λ‹€λŠ” λœ»μ΄λ‹€. μ•žμ— 0을 μ±„μ›Œμ•Όμ§€ μ›λž˜ 수 κ·ΈλŒ€λ‘œ 자리수만 늘릴 수 있음.)
    ex) 101 == 0101 == 00101

  3. 루트 λ…Έλ“œλΆ€ν„° μ‹œμž‘ν•΄μ„œ DFS탐색. λ§Œμ•½ μžμ‹ λ…Έλ“œκ°€ 1인데 λΆ€λͺ¨ λ…Έλ“œκ°€ 0일 경우 ν‘œν˜„ν•  수 μ—†λŠ” ν˜•νƒœμž„.

μ°Έκ³ ν•œ 레퍼런슀 : https://velog.io/@ggb05224/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4-%ED%91%9C%ED%98%84-%EA%B0%80%EB%8A%A5%ED%95%9C-%EC%9D%B4%EC%A7%84%ED%8A%B8%EB%A6%AC-python

πŸ“š μƒˆλ‘­κ²Œ μ•Œκ²Œλœ λ‚΄μš©

@tgyuuAn tgyuuAn added tgyuuAn ν•œ μ€„λ‘œλŠ” μ†Œκ°œν•  수 μ—†λŠ” λ‚¨μž. μž‘μ„± 쀑 ⏱️ labels Sep 8, 2024
@tgyuuAn tgyuuAn self-assigned this Sep 8, 2024
@tgyuuAn tgyuuAn requested a review from H0ngJu September 8, 2024 07:20
@tgyuuAn tgyuuAn marked this pull request as ready for review September 8, 2024 07:23
Copy link
Collaborator

@H0ngJu H0ngJu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

문제 ν•΄μ„ν•˜λŠ”λ° μ‹œκ°„μ΄ κ±Έλ ΈμŠ΅λ‹ˆλ‹€ 주어진 수둜 μ΄μ§„νŠΈλ¦¬λ‘œ λ§Œλ“€κ³ , 포화 μ΄μ§„νŠΈλ¦¬μΈμ§€ ν™•μΈν•˜μ—¬μ•Ό ν•˜λŠ” λ¬Έμ œλ„€μš” 첨엔 λ­” 말인가 ν–ˆλ„€μš”

포화 μ΄μ§„νŠΈλ¦¬λ„ μ•Œμ•„μ•Όν•˜κ³ , 트리 inorder μˆœνšŒλ„ μ•Œμ•„μ•Όν•˜κ³ ,,
λ¬Έμ œμ—μ„œ μ„€λͺ…을 ν•΄μ£ΌκΈ΄ ν•˜μ§€λ§Œ,
νŠΈλ¦¬μ— λŒ€ν•΄μ„œ 잘 μ•Œκ³  μžˆμ–΄μ•Ό 접근도 잘 ν•  수 μžˆμ„ 것 κ°™μ•„μš”

이번 λ¬Έμ œλŠ” νŠΈλ¦¬μ— λŒ€ν•œ 곡뢀가 뢀쑱함을 κΉ¨λ‹«λŠ” λ¬Έμ œμ˜€λ„€μš”,, 🌳

문제 ν‘ΈλŠλΌ κ³ μƒν•˜μ…¨μŠ΅λ‹ˆλ‹€ !!! 내일뢀터 μƒˆλ‘œμ›Œμ§„ μ•Œκ³ λ¦¬λ“œλ―Έ1둜 λ΅™κ² μ–΄μš” ,,,,

@tgyuuAn tgyuuAn merged commit 9fe0fcb into main Sep 20, 2024
@tgyuuAn tgyuuAn deleted the 76-tgyuuAn branch September 20, 2024 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tgyuuAn ν•œ μ€„λ‘œλŠ” μ†Œκ°œν•  수 μ—†λŠ” λ‚¨μž. 리뷰 μ™„λ£Œ βœ”οΈ
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants